package com.zr.java8.pattern.strategy.impl;

import com.zr.java8.pattern.strategy.ValidationStrategy;

public class Validator {
    private final ValidationStrategy strategy;

    public Validator(ValidationStrategy strategy) {
        this.strategy = strategy;
    }

    public boolean validate(String s) {
        return strategy.execute(s);
    }

    public static void main(String[] args) {
        Validator numericValidator = new Validator(s -> s.matches("[a-z]]+"));
        boolean aaa = numericValidator.validate("aaa");
        System.out.println(aaa);
    }
}
